<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('产品名称')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('产品规格')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-specification" class="form-control" name="row[specification]" rows="3"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('状态')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[status]', ['1'=>__('正常'), '0'=>__('禁用')])}
        </div>
    </div>
    
    <!-- 自定义字段 -->
    {if isset($customFieldsHtml) && $customFieldsHtml}
    {:htmlspecialchars_decode($customFieldsHtml)}
    {/if}
    
    <!-- 型号和工价录入区域 -->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">型号和工价:</label>
        <div class="col-xs-12 col-sm-8">
            <div id="model-container">
                <div class="model-item" data-index="0" style="border: 1px solid #ddd; padding: 15px; margin-bottom: 15px; border-radius: 5px;">
                    <h5 style="margin-bottom: 15px; color: #333;">型号信息</h5>
                    <div class="row" style="margin-bottom: 15px;">
                        <div class="col-md-4">
                            <label>型号名称:</label>
                            <input type="text" class="form-control" name="models[0][name]" placeholder="请输入型号名称" required>
                        </div>
                        <div class="col-md-3">
                            <label>型号编码:</label>
                            <input type="text" class="form-control" name="models[0][model_code]" placeholder="请输入型号编码">
                        </div>
                        <div class="col-md-3">
                            <label>型号描述:</label>
                            <input type="text" class="form-control" name="models[0][description]" placeholder="请输入型号描述">
                        </div>
                        <div class="col-md-2">
                            <label>&nbsp;</label><br>
                            <button type="button" class="btn btn-danger btn-sm remove-model">删除</button>
                        </div>
                    </div>
                    <h6 style="margin-bottom: 10px; color: #666;">工序工价设置</h6>
                    <div class="price-table">
                        <table class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>工序</th>
                                    <th>计件工价(元/件)</th>
                                    <th>计时工价(元/小时)</th>
                                </tr>
                            </thead>
                            <tbody>
                                {volist name="processList" id="process"}
                                <tr>
                                    <td>{$process.name}</td>
                                    <td>
                                        <input type="number" class="form-control" name="prices[{$process.id}][0]" placeholder="0.00" step="0.01" min="0">
                                    </td>
                                    <td>
                                        <input type="number" class="form-control" name="prices[{$process.id}_time][0]" placeholder="0.00" step="0.01" min="0">
                                    </td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <button type="button" class="btn btn-primary btn-sm" id="add-model">添加型号</button>
        </div>
    </div>
    
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<!-- 隐藏的工序数据 -->
<script type="application/json" id="process-data">{$processListJson}</script>